<?php

namespace app\admin\controller;

use app\model\MenuModel;
use app\service\MenuService;

class Menu extends Base
{

    public function __construct(MenuService $menuService)
    {
        parent::__construct();
        $this->service = $menuService;
    }


    /**
     * @return \think\response\View
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\ModelNotFoundException
     * @throws \think\exception\DbException
     */
    public function index()
    {
        $data = collection($this->checkPermissions($this->adminInfo['role_id']))->column('menu_id');
        $MenuModel = new MenuModel();
        $where['id'] = ['in',$data];
        $menuInfo = $MenuModel->where($where)->select();
        $info = $this->service->setMenu($menuInfo);
        $this->assign('info',$info);
        return view();
    }

    public function table()
    {
        return view();
    }

    public function main()
    {
        return view();
    }




}